%
3
10
1
38
        SAVING PROGRAMS

In the last section, you wrote a
computer program that prints four
lines of heartfelt verse.
^
%
3
8
1
38
To review what your program looks
like, type LIST.
^
%
3
8
1
38
There it is!  Your famous first
words.  Right now, your program is
stored in the computer's memory.
^
%
3
10
1
38
But if you or some unsuspecting
friend turns off your computer,
the program will be gone forever,
or at least gone until you get
around to retyping it.
^
&
Rather than having to retype your
programs each time you turn on
the computer, you can use the SAVE
command to save your programs on a
disk.
^
&
Then, when you're ready to run a
program, you can use the LOAD
command to load the program
back into the computer's memory.
^
&
When you give the SAVE command,
your computer copies the program
in memory into a file on the disk
in your disk drive.
^
&
To keep programs from getting
mixed up when you store them on
the disk, you must give each
program a different name.
^
%
3
9
1
38
Let's name your program POEM.  To
store POEM on the disk, type...

SAVE POEM     (and press RETURN)
^
%
3
9
1
38
Good job!  You've just saved a
program.  Notice that after you
give the SAVE command, the disk
use light turns on.
^
&
When the light turns off, you know
your program is stored safely on
the disk as well as in the
computer's memory.
^
&
Press RETURN for a demonstration
of what happens when you use the
SAVE command.
^
%
20
24
1
38
This is a picture of an Apple II
with an external disk drive.
^
&
When you write your program, it
goes into the computer's memory.
^
&
SAVE copies the program in memory
onto the disk in the disk drive.
^
&
Notice, however, that the
program is still in memory.
^
&
The SAVE command doesn't erase
the computer's memory.
^
%
3
9
1
38
But let's say you're basically a
suspicious sort who wants hard
proof that the program is really
on the disk.
^
&
Well, lucky for you, your disk
keeps track of all the programs
it contains.  It keeps them in a
catalog.
^
%
3
10
1
38
CAT is the command you use to
display the catalog.  Try it now.
Type...

CAT           (and press RETURN)
^
%
3
11
1
38
There's the catalog.  As you can
see, you've only saved one
program (POEM) on your simulation
disk so far.  (Don't worry about
the numbers after the names.  They
aren't important right now.)
^
%
3
9
1
38
Since your program is now saved
on the disk, you can erase it from
the computer's memory and it will
remain on the disk.
^
&
You use the NEW command to erase
a program from memory.  It's
called NEW because it lets you
make room for a new program.
^
&
Why don't you try it now?  Type

NEW         (and press RETURN)
^
%
3
9
1
38
There.  Your program is no
longer in memory.  But don't take
our word for it.  Try running
your program.
^
%
3
7
1
38
Surprise!  Nothing happens because
the program is gone from memory.
^
&
Press RETURN and we'll show you
what happened to your program.
^
%
20
24
1
38
Your program was in memory
and was also saved on the disk.
^
&
When you typed NEW, the program
was erased from memory.
^
&
However, the copy of the program
on the disk remains.
^
%
3
11
1
38
At this point you could start
writing another program.  But
let's suppose that you're suddenly
overcome with the desire to make
your verse even more poetic.
^
&
Your first task is to get a copy
of your program from the disk and
put it in the computer's memory.
To do this, you use the LOAD
command, followed by the name of
the program you want to work on.
^
%
3
9
1
38
You saved your program as POEM.
So type:

LOAD POEM    (and press RETURN)
^
%
3
9
1
38
Excellent!  Your POEM program
is back in memory!  Press RETURN
and we'll show you how it got
there.
^
%
20
24
1
38
Your POEM program was saved on
the disk.
^
&
When you loaded it, a copy of the
program was sent to memory.
^
&
But notice that the original
program stayed on the disk.
^
%
3
8
1
38
Try listing your program now (to
make certain that it's really
there).
^
%
3
9
1
38
There it is, the same poem you
saved at the beginning of
this section.  And remember, the
original is still on the disk.
^
%
3
10
1
38
Now that your program is back in
memory, why don't you change line
30 (press RETURN for a hint if you
don't remember how to change a
line).
^
%
3
11
1
38
Great job.  Clearly this is a
verse worth saving.  You already
have one program on the disk.  If
you were to save this program
under the same name, the new pro-
gram would replace the old one.
^
%
3
9
1
38
Because you want to save both
programs, you should save this one
under some other name.  Go ahead,
save your modified poem now.
^
%
3
9
1
38
Congratulations!  Now catalog the
disk just to make sure that both
poems are tucked away safely on
the disk.
^
%
3
12
1
38
Sure enough!  Both programs are
there.  Just one small request
before we go on.  If you ever get
either of these wonderful poems
published, please give Apple
credit for providing the
inspiration.
^
&
You have learned a whole lot so
far.  You now know how to write
and change simple BASIC programs,
how to save them on a disk, how
to check the contents of a disk,
and how to load programs into
memory.
^
&
At this point, you may want to
continue with the next section, or
you may want to stop and practice
writing and saving some programs
of your own.
^
&
If you want to practice,
press ESC to go to the menu,
then select Quit.  Otherwise,
press RETURN to learn more about
programming in BASIC.
^
